TextBox.inherit("Control");


function TextBox(node){
    this.Control(node);
    
	this.submitState=this.properties.getString("submitState");
	this.textForm=document.getElementById(this.properties.getString("id"));
}

/*
function TextBox(controlId, submitState){
	this.submitState=submitState;
	this.textForm=document.getElementById(controlId);

}
*/
TextBox.prototype.getEventHandler=function () {
	if (!this.eventHandler){
		this.eventHandler=new EventHandler(this, this.textForm);
	}

	return this.eventHandler;
}

TextBox.prototype.clear=function () {
	if (!this.textForm.disabled) {
		this.textForm.value="";
	}
}
							
TextBox.prototype.toString=function () {
	return this.submitState;
//	return this.getText();
}

TextBox.prototype.populate=function (prefix, results) {
	this.textForm.value=results.getValue(prefix+".text");
	//this.textForm.value=values.values[1];
}

TextBox.prototype.getText=function () {
	return this.textForm.value;
}

TextBox.prototype.setText=function (value) {
	this.textForm.value=value;
}

TextBox.prototype.setEnabled=function (enabled) {
	this.textForm.disabled = !enabled;
}

TextBox.prototype.populatePopupParameters=function (prefix, parameters) {
	parameters.add(prefix+".text", this.textForm.value);	
}

TextBox.prototype.getValue=function () {
	return this.getText();
}

TextBox.prototype.setValue=function (value) {
	this.setText(value);
}

TextBox.prototype.setVisible=function (value) {
	this.textForm.style.visibility=value?"visible":"hidden";
}

TextBox.prototype.getVisible=function () {
	var visibility=this.textForm.style.visibility;
	if (!visibility){
		return true;
	}
	return visibility=="visible"?true:false;
}
